#include <stdio.h>
#include<stdlib.h> //绝对值函数不在math.h库中，且适用于long int类型数据的是labs，而非abs

long GCD(long big, long small);
//long MaxYueShu(long fenzi, long fenmu);

int main()
{
    int n;
    long x, y, x1, y1, gcd;
    scanf("%d", &n);
    scanf("%ld/%ld", &x, &y);
    for (int i = 0; i < n - 1; i++)
    {
        scanf("%ld/%ld", &x1, &y1);
        if(labs(x * y1 + x1 * y) >= y * y1)
        {
            gcd = GCD(labs(x1 * y + x * y1), y * y1);
        }
        else if(labs(x * y1 + x1 * y) < y * y1 && x * y1 + x1 * y != 0)
        {
            gcd = GCD(y * y1, labs(x1 * y + x * y1));
        }
        else if(x * y1 + x1 * y == 0)
        {
            gcd = 1;
        }
        x = (x1 * y + x * y1) / gcd;
        y = (y * y1) / gcd;
    }

    if (x / y == 0 && x != 0)
    {
        printf("%ld/%ld", x, y);
    }
    else if (x % y == 0 && x != 0)
    {
        printf("%ld", x / y);
    }
    else if(x == 0)
    {
        printf("0");
    }
    else
    {
        printf("%ld %ld/%ld", x / y, x % y, y);
    }

    return 0;
}

long GCD(long big, long small)
{
    return big % small == 0?small : GCD(small, big % small);
}


/*
long MaxYueShu(long fenzi, long fenmu)
{
    long gcd = 1;
    if(fenzi < 0)fenzi = -fenzi; // fenzi若为负，则永远不可能进入下面的for循环
    for (long i = 1; i <= fenzi; i++)
    {
        if (fenzi % i == 0 && fenmu % i == 0)
        {
            gcd = i;
        }
    }
    return gcd;
}
*/